package com.talangniao.db;

import java.lang.reflect.Method;

import com.talangniao.manager.DaoManager;

import org.springframework.aop.MethodBeforeAdvice;

public class BeginConnManager implements MethodBeforeAdvice {

    private ConnectionManager cm;
    public void setCm(ConnectionManager cm){this.cm = cm;}
    public void before(Method method, Object[] params, Object obj) throws Throwable {
       System.out.println("******************");
    	DaoManager dm = (DaoManager)obj;
        System.out.println(cm.getCon());
        dm.setConnection(cm.getCon());
        System.out.println("[INFO] connection is opened for "+method.getName());
    }

}
